package stereo.autoconfig.soundsystem;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * Created by EricChen on 29/12/2016.
 */

@Component
public class CDPlayer implements MediaPlayer {

    private CompactDisc cd;

    @Autowired(required=true)
    public CDPlayer(CompactDisc cd) {
        this.cd = cd;
    }

    @Autowired(required=true)
    public void setCompactDisc(CompactDisc cd) {
        this.cd = cd;
    }

    @Autowired(required=true)
    public void insertDisc(CompactDisc cd) {
        this.cd = cd;
    }

    public void play() {
        cd.play();
    }
}
